<!doctype html>
<html class="no-js">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="description" content="">
		<meta name="keywords" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>欢迎使用金管家进销存</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="stylesheet" href="css/amazeui.min.css">
		<link rel="stylesheet" href="css/app.css">
	</head>

	<body>
		<div class="am-g myapp-login">
			<div class="myapp-login-logo-block">
				<div class="myapp-login-logo">
					<i class="am-icon-jsfiddle"></i>
				</div>
				<div class="myapp-login-logo-text">
					<div class="myapp-login-logo-text">
						<span>金管家进销存</span>
						<div class="info">欢迎使用金管家进销存</div>
					</div>
				</div>

				<div class="login-font">
					<i>Log In </i> or <span> Sign Up</span>
				</div>
				<div class="am-u-sm-10 login-am-center">
					<form class="am-form" id="fm">
						<fieldset>
							<div class="am-form-group">
								<input type="text" class="" id="doc-ipt-email-1" name="userName" placeholder="请您先输入用户">
							</div>
							<div class="am-form-group">
								<input type="password" class="" id="doc-ipt-pwd-1" name="password" placeholder="输入个密码吧">
							</div>
							<p><button type="button" class="am-btn am-btn-default" id="login" onclick="goLogin()">-----登陆-----</button></p>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
		<script src="js/common.js"></script>
		<!--<script src="js/jquery.min.js"></script>-->
		<!--<script src="js/amazeui.min.js"></script>
		<script src="js/app.js"></script>-->
	</body>
	<script type="application/javascript">
		function goLogin() {
			var name = $("#doc-ipt-email-1").val(); //账号
			var pwd = $("#doc-ipt-pwd-1").val(); //密码
			if(name == '' || name == null || name == undefined) {
				alert('登录账号不能为空！');
				return false;
			}
			if(pwd == '' || pwd == null || pwd == undefined) {
				alert('密码不能为空！');
				return false;
			}
			//发起登录
			$.post(globalData.server + 'user/login',
				$("#fm").serialize(),
				function(res) {
					if(res.no1) {
						alert(res.no1);
					} else {
						if(res.no2) {
							alert(res.no2);
						} else {
							globalData.setToken(res.token)
							globalData.setUserName(res.userName)
							window.location.href = "index.html";
						}
					}
				}, "json")
		}
	</script>

</html>